<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>进入购物车效果</title>
  <style>
    *{
      margin: 0;
      padding: 0;
    }
    .box{
      width: 500px;
      height: 500px;
      border: 1px solid #777;
      margin: 30px auto;
    }
    .outer{
      width: 30px;
      height: 30px;
      transition: all 0.8s linear;
    }
    .inner{
      width: 30px;
      height: 30px;
      border-radius: 50%;
      background-color: #eee;
      transition: 0.8s all cubic-bezier(0.14,-1.33,1,0.18);
    }
    .run .outer{
      transform: translate3d(300px, 0, 0);
    }
    .run .inner{
      transform: translate3d(0, 400px, 0);
    }
  </style>
  <script>
    window.onload = function(){
      let btn = document.querySelector('#btn')
      let btn1 = document.querySelector('#btn1')
      let box = document.querySelector('.box')
      let outer = document.querySelector('.outer')
      let inner = document.querySelector('.inner')
      btn.onclick = function(){
        box.className += " run"
      }
      btn1.onclick = function(){
        box.className = 'box'
      }
    }
  </script>
</head>
<body>
  <button id="btn">移动</button>
  <button id="btn1">恢复</button>
  <div class="box">
    <div class="outer">
      <div class="inner"></div>
    </div>
  </div>
</body>
</html>
